package hr.controller;

import hr.mapper.SysMapper;
import hr.service.SysService;
import hr.utils.Result.R;
import hr.utils.Result.Result;
import hr.utils.Result.ResultUtil;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 获取系统参数
 */
@RestController
@RequestMapping("/system")
public class SysController {
    @Autowired
    private SysMapper sysMapper;
    @Autowired
    private SysService sysService;

    /**
     * 获取性别
     * @return
     */
    @Operation(summary = "性别")
    @PostMapping("/getSysGender")
    public R getSysGender() {
        List<Map<String,Object>> list =  sysService.selectSysGender();
        return R.success().addKeyValueToData("list",list);
    }

    /**
     * 获取部门状态
     * @return
     */
    @PostMapping("/getSysDepState")
    public R getSysDepState() {
        List<Map<String,Object>> list =  sysMapper.getSysDepState();
        return R.success().addKeyValueToData("list",list);
    }

    @Operation(summary = "获取婚姻状态")
    @PostMapping("/getSysMarriage")
    public R getSysMarriage() {
        List<Map<String, Object>> list = sysMapper.getSysMarriage();
        return R.success().addKeyValueToData("list",list);
    }

    @Operation(summary = "获取民族")
    @PostMapping("/getSysNation")
    public R getSysNation() {
        List<Map<String, Object>> list = sysMapper.getSysNation();
        return R.success().addKeyValueToData("list",list);
    }

    @Operation(summary = "获取离职状态")
    @PostMapping("/getSysLeaveStatus")
    public R getSysLeaveStatus() {
        List<Map<String, Object>> list = sysMapper.getSysLeaveStatus();
        return R.success().addKeyValueToData("list",list);
    }

    @Operation(summary = "获取离职类型")
    @PostMapping("/getSysLeaveType")
    public R getSysLeaveType() {
        List<Map<String, Object>> list = sysMapper.getSysLeaveType();
        return R.success().addKeyValueToData("list",list);
    }

}
